<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"
	import="javax.ejb.*,javax.naming.*,com.tiger.cmpeb.sample3.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登録</title>
</head>
<body>
<%
	//request.setCharacterEncoding("JISAutoDetect");

	InitialContext ctx = new InitialContext();
	//"java:comp/env/ejb/CustomerBean03" → "comp/env/ejb/CustomerBean03"
	CustomerHome03 customerHome = (CustomerHome03) ctx.lookup("comp/env/ejb/CustomerBean03");
	//"java:comp/env/ejb/AddressBean02" → "comp/env/ejb/CustomerBAddressBean02ean03"
	AddressHome02 addressHome = (AddressHome02) ctx.lookup("comp/env/ejb/AddressBean02");

	Integer addressID = new Integer(request.getParameter("addressID"));
	String zipCode = request.getParameter("zipCode");
	String prefecture = request.getParameter("prefecture");
	String country = request.getParameter("country");
	String city = request.getParameter("city");
	
	Address02 address = addressHome.create(addressID,zipCode,country,prefecture,city);
	
	Integer customerID = new Integer(request.getParameter("customerID"));
	String customerName = request.getParameter("customerName");
	Customer03 customer = customerHome.create(customerID,customerName);
	
	customer.setAddress(address);
	
	out.println("登録完了");
	
%>
</body>
</html>